Confine the knowledge that the buffer gets accessed without use of
proper guest handle accessors to a single file.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
return error;
}
-int microcode_update(void *buf, unsigned long len)
+int microcode_update(XEN_GUEST_HANDLE(void) buf, unsigned long len)
{
int ret;
return -EINVAL;
}
+ if (len != (typeof(user_buffer_size))len) {
+ printk(KERN_ERR "microcode: too much data\n");
+ return -E2BIG;
+ }
+
mutex_lock(µcode_mutex);
- user_buffer = (void __user *) buf;
- user_buffer_size = (int) len;
+ user_buffer = buf.p;
+ user_buffer_size = len;
ret = do_microcode_update();
case XENPF_microcode_update:
{
- extern int microcode_update(void *buf, unsigned long len);
- ret = microcode_update(op->u.microcode.data.p,
+ extern int microcode_update(XEN_GUEST_HANDLE(void), unsigned long len);
+ ret = microcode_update(op->u.microcode.data,
op->u.microcode.length);
}
break;